home *** CD-ROM | disk | FTP | other *** search
- ` ------------------------------------------------------------------------
- ` Rasters Demonstration DarkForge Snippet (6/8/2000)
- ` ------------------------------------------------------------------------
- `
- ` Okay so they aren't real rasters - but they look good anyway! Includes
- ` my raster function for your own use.
-
- sync rate 0
- sync on
- hide mouse
-
- ` Call the raster function
- ` sprite #, starting colour, apply shades, height, step, multiplier
- ` (0 for 180, 45 for 90)
-
- raster(1, 0,0,40, 0,0,1, 180, 2,0)
- raster(2, 0,40,0, 0,1,0, 180, 2,0)
-
- cls 0 : y#=-195 : y2#=664
-
- ` stars!
-
- n=50
- dim x(n,3)
-
- for i=1 to n
- x(i,1)=rnd(639)+1
- x(i,2)=rnd(479)+ 1
- x(i,3)=rnd(9)+1
- next i
-
- do
-
- cls 0
-
- sprite 1,0,y#,1
- inc y#,4
- if y#>660 then y#=-195
-
- sprite 2,0,y2#,2
- dec y2#,4
- if y2#<-195 then y2#=664
-
- for i=1 to n
-
- x(i,1)=x(i,1)-x(i,3)
-
- if x(i,1)<=1
- x(i,1)=640
- x(i,2)=rnd(479)+1
- endif
-
- col=x(i,3)*30
- ink rgb(col,col,col),1
-
- dot x(i,1),x(i,2)
-
- next i
-
- sync
-
- loop
-
-
- ` Make my rasters
-
- function raster(i,r,g,b,ro,go,bo,h,s,m)
-
- y=0
-
- repeat
-
- if ro=1 then rro=sin(y+m)*100
- if go=1 then ggo=sin(y+m)*100
- if bo=1 then bbo=sin(y+m)*100
-
- red=r+rro
- if red>255 then red=255
-
- green=g+ggo
- if green>255 then green=255
-
- blue=b+bbo
- if blue>255 then blue=255
-
- ink rgb(red,green,blue),1
-
- line 0,y,640,y+1
- inc y,s
-
- until y=h
-
- get image i,0,0,640,h
- sprite i,0,-400,i
- set sprite i,0,1
-
- endfunction
-
-